package tienmanh.gs.goldminer.util;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;

import tienmanh.gs.goldminer.manager.ResourcesManager;



public class Map {

//	/map đặc biệt
	//13 . 24 . 33 . 45 . 55 . 63 . 71 . 85 . 94 . 105
	private static String filePathData = "file/mapvalue.txt";
	public static HashMap<Integer, Point> myLevel;
	private static Point level;
//	private static ArrayList<Point> arrLevel;
	
		public static ArrayList<String> readText() throws Exception{
			ArrayList<String> data = new ArrayList<String>();
			BufferedReader br = new BufferedReader(new InputStreamReader(ResourcesManager.getInstance().activity.getAssets().open(filePathData)));
			String line;
			while ((line = br.readLine()) != null) {
				data.add(line);
			}
			br.close();
			return data;
		}
		
		public static Point addtoMap(String s){
			level = new Point();
			String resString[] = s.split(",");
			for (int i = 0; i < resString.length; i++) {
				level = new Point(Integer.parseInt(resString[0]), Integer.parseInt(resString[1]));
			}
			return level;
		}
		public static HashMap<Integer, Point> getDatalevel() throws Exception{
			myLevel = new HashMap<Integer, Point>();
			ArrayList<String> s = readText();
			for (int i = 0; i < s.size(); i++) {
				myLevel.put((i+1),addtoMap((s.get(i))));
			}
		return myLevel;	
		}
}
